package com.nts.visionworks.core.security.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.nts.visionworks.core.validation.EntityIdNotNull;

/**
 * SecurityIdentity generated by hbm2java
 */
@Entity
@Table(name = "security_identity", catalog = "visionworks")
public class SecurityIdentity implements java.io.Serializable
{

	private Long identityId;
	private SecurityAuthority securityAuthority;
	private String securityId;
	private String securityPassword;
	private boolean expired;
	private boolean locked;
	private boolean credentialExpired;
	private boolean enabled;
	private Date createdDateTime;
	private Long creatorId;
	private Date updatedDateTime;
	private Set<ManagementMember> managementMembers = new HashSet<ManagementMember>(
			0);
	private Set<SecurityAccessTrace> securityAccessTraces = new HashSet<SecurityAccessTrace>(
			0);
	private Set<SecurityGroup> securityGroups = new HashSet<SecurityGroup>(0);

	public SecurityIdentity()
	{
	}

	public SecurityIdentity(SecurityAuthority securityAuthority,
			String securityId, String securityPassword, boolean expired,
			boolean locked, boolean credentialExpired, boolean enabled,
			Date createdDateTime)
	{
		this.securityAuthority = securityAuthority;
		this.securityId = securityId;
		this.securityPassword = securityPassword;
		this.expired = expired;
		this.locked = locked;
		this.credentialExpired = credentialExpired;
		this.enabled = enabled;
		this.createdDateTime = createdDateTime;
	}

	public SecurityIdentity(SecurityAuthority securityAuthority,
			String securityId, String securityPassword, boolean expired,
			boolean locked, boolean credentialExpired, boolean enabled,
			Date createdDateTime, Long creatorId, Date updatedDateTime,
			Set<ManagementMember> managementMembers,
			Set<SecurityAccessTrace> securityAccessTraces,
			Set<SecurityGroup> securityGroups)
	{
		this.securityAuthority = securityAuthority;
		this.securityId = securityId;
		this.securityPassword = securityPassword;
		this.expired = expired;
		this.locked = locked;
		this.credentialExpired = credentialExpired;
		this.enabled = enabled;
		this.createdDateTime = createdDateTime;
		this.creatorId = creatorId;
		this.updatedDateTime = updatedDateTime;
		this.managementMembers = managementMembers;
		this.securityAccessTraces = securityAccessTraces;
		this.securityGroups = securityGroups;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "IdentityId", unique = true, nullable = false)
	public Long getIdentityId()
	{
		return this.identityId;
	}

	public void setIdentityId(Long identityId)
	{
		this.identityId = identityId;
	}

	@EntityIdNotNull(message = "validation.securityIdentity.securityAuthority.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "AuthorityId", nullable = false)
	public SecurityAuthority getSecurityAuthority()
	{
		return this.securityAuthority;
	}

	public void setSecurityAuthority(SecurityAuthority securityAuthority)
	{
		this.securityAuthority = securityAuthority;
	}

	@NotNull(message = "validation.securityIdentity.securityId.notNull")
	@Size(message = "validation.securityIdentity.securityId.length", max = 50, min = 3)
	@Column(name = "SecurityId", nullable = false, length = 50)
	public String getSecurityId()
	{
		return this.securityId;
	}

	public void setSecurityId(String securityId)
	{
		this.securityId = securityId;
	}

	@NotNull(message = "validation.securityIdentity.securityPassword.notNull")
	@Size(message = "validation.securityIdentity.securityPassword.length", max = 100, min = 4)
	@Column(name = "SecurityPassword", nullable = false, length = 100)
	public String getSecurityPassword()
	{
		return this.securityPassword;
	}

	public void setSecurityPassword(String securityPassword)
	{
		this.securityPassword = securityPassword;
	}

	@Column(name = "Expired", nullable = false)
	public boolean isExpired()
	{
		return this.expired;
	}

	public void setExpired(boolean expired)
	{
		this.expired = expired;
	}

	@Column(name = "Locked", nullable = false)
	public boolean isLocked()
	{
		return this.locked;
	}

	public void setLocked(boolean locked)
	{
		this.locked = locked;
	}

	@Column(name = "CredentialExpired", nullable = false)
	public boolean isCredentialExpired()
	{
		return this.credentialExpired;
	}

	public void setCredentialExpired(boolean credentialExpired)
	{
		this.credentialExpired = credentialExpired;
	}

	@Column(name = "Enabled", nullable = false)
	public boolean isEnabled()
	{
		return this.enabled;
	}

	public void setEnabled(boolean enabled)
	{
		this.enabled = enabled;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CreatedDateTime", nullable = false, length = 19)
	public Date getCreatedDateTime()
	{
		return this.createdDateTime;
	}

	public void setCreatedDateTime(Date createdDateTime)
	{
		this.createdDateTime = createdDateTime;
	}

	@Column(name = "CreatorId")
	public Long getCreatorId()
	{
		return this.creatorId;
	}

	public void setCreatorId(Long creatorId)
	{
		this.creatorId = creatorId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "UpdatedDateTime", length = 19)
	public Date getUpdatedDateTime()
	{
		return this.updatedDateTime;
	}

	public void setUpdatedDateTime(Date updatedDateTime)
	{
		this.updatedDateTime = updatedDateTime;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "security_identity_member", catalog = "visionworks", joinColumns =
	{ @JoinColumn(name = "IdentityId", nullable = false, updatable = false) }, inverseJoinColumns =
	{ @JoinColumn(name = "MemberId", nullable = false, updatable = false) })
	public Set<ManagementMember> getManagementMembers()
	{
		return this.managementMembers;
	}

	public void setManagementMembers(Set<ManagementMember> managementMembers)
	{
		this.managementMembers = managementMembers;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "securityIdentity")
	public Set<SecurityAccessTrace> getSecurityAccessTraces()
	{
		return this.securityAccessTraces;
	}

	public void setSecurityAccessTraces(
			Set<SecurityAccessTrace> securityAccessTraces)
	{
		this.securityAccessTraces = securityAccessTraces;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "security_identity_group", catalog = "visionworks", joinColumns =
	{ @JoinColumn(name = "IdentityId", nullable = false, updatable = false) }, inverseJoinColumns =
	{ @JoinColumn(name = "GroupId", nullable = false, updatable = false) })
	public Set<SecurityGroup> getSecurityGroups()
	{
		return this.securityGroups;
	}

	public void setSecurityGroups(Set<SecurityGroup> securityGroups)
	{
		this.securityGroups = securityGroups;
	}

}
